package com.ruoyi.purchase.service.impl;

import com.ruoyi.purchase.domain.SysGroupUser;
import com.ruoyi.purchase.mapper.SysGroupUserMapper;
import com.ruoyi.purchase.service.ISysGroupUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 分组用户关联Service业务层处理
 *
 * @author ruoyi
 * @date 2025-08-23
 */
@Service
public class SysGroupUserServiceImpl implements ISysGroupUserService
{
    @Autowired
    private SysGroupUserMapper sysGroupUserMapper;

    /**
     * 根据分组ID查询用户ID列表
     *
     * @param groupId 分组ID
     * @return 用户ID列表
     */
    @Override
    public List<Long> selectUserIdsByGroupId(Long groupId) {
        return sysGroupUserMapper.selectUserIdsByGroupId(groupId);
    }

    /**
     * 查询分组用户关联
     *
     * @param groupId 分组用户关联主键
     * @return 分组用户关联
     */
    @Override
    public SysGroupUser selectSysGroupUserByGroupId(Long groupId)
    {
        return sysGroupUserMapper.selectSysGroupUserByGroupId(groupId);
    }

    /**
     * 查询分组用户关联列表
     *
     * @param sysGroupUser 分组用户关联
     * @return 分组用户关联
     */
    @Override
    public List<SysGroupUser> selectSysGroupUserList(SysGroupUser sysGroupUser)
    {
        return sysGroupUserMapper.selectSysGroupUserList(sysGroupUser);
    }

    /**
     * 新增分组用户关联
     *
     * @param sysGroupUser 分组用户关联
     * @return 结果
     */
    @Override
    public int insertSysGroupUser(SysGroupUser sysGroupUser)
    {
        return sysGroupUserMapper.insertSysGroupUser(sysGroupUser);
    }

    /**
     * 修改分组用户关联
     *
     * @param sysGroupUser 分组用户关联
     * @return 结果
     */
    @Override
    public int updateSysGroupUser(SysGroupUser sysGroupUser)
    {
        return sysGroupUserMapper.updateSysGroupUser(sysGroupUser);
    }

    /**
     * 批量删除分组用户关联
     *
     * @param groupIds 需要删除的分组用户关联主键
     * @return 结果
     */
    @Override
    public int deleteSysGroupUserByGroupIds(Long[] groupIds)
    {
        return sysGroupUserMapper.deleteSysGroupUserByGroupIds(groupIds);
    }

    /**
     * 删除分组用户关联信息
     *
     * @param groupId 分组用户关联主键
     * @return 结果
     */
    @Override
    public int deleteSysGroupUserByGroupId(Long groupId)
    {
        return sysGroupUserMapper.deleteSysGroupUserByGroupId(groupId);
    }

    @Override
    public List<Long> selectUserIdsByGroupIds(Long[] groupIds) {
        return sysGroupUserMapper.selectUserIdsByGroupIds(groupIds);
    }
}
